'   T%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%W%
 
 '   Q%  T O R Q U E   M E T E R                                                                 Q%
 
 '   Z%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%P%]%
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T E S T   P A R A M E T E R S 
 
 T e s t N m   =   2 
 
 M a x T e m p   =   7 0 
 
 M i n T e m p   =   4 0 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   M O T O R   P A R A M E T E R S 
 
 M a x T O R Q U E   =   1 0 0 
 
 M a x A C C   =       1 0 0 0 
 
 M a x R P M   =       1 0 0 0 
 
 P i d K P     =       5 0 
 
 P i d K I     =       5 0 
 
 P i d K D     =         0 
 
 D e a d B a n d   =     5 
 
 Z e r o S p e e d C u r r e n t   =   0 
 
 
 
 K r e d u c t i o n   =   4 1 
 
 M o t o r I D   =   1 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   B U T T O N S   a n d   K E Y S 
 
 B u t t o n   1   L a b e l   B _ T o r q u e 
 
 B u t t o n   2   L a b e l   B _ A c c e l e r a t i o n 
 
 B u t t o n   3   L a b e l   B _ S p e e d 
 
 
 
 B u t t o n   5   L a b e l   B _ N e w t o n M e t e r 
 
 B u t t o n   6   L a b e l   L o n g _ T e s t 
 
 B u t t o n   L o n g _ T e s t   C o l o r   G o l d 
 
 
 
 B u t t o n   1 0   L a b e l   + 1 0 _ t u r n s 
 
 B u t t o n   + 1 0 _ t u r n s   C o l o r   G o l d 
 
 B u t t o n   1 1   L a b e l   - 1 0 _ t u r n s 
 
 B u t t o n   - 1 0 _ t u r n s   C o l o r   G o l d 
 
 B u t t o n   1 2   L a b e l   + 1 0 0 _ t u r n s 
 
 B u t t o n   + 1 0 0 _ t u r n s   C o l o r   G o l d 
 
 B u t t o n   1 3   L a b e l   - 1 0 0 _ t u r n s 
 
 B u t t o n   - 1 0 0 _ t u r n s   C o l o r   G o l d 
 
 B u t t o n   1 4   L a b e l   G o t o - Z e r o 
 
 B u t t o n   G o t o - Z e r o   C o l o r   O r a n g e 
 
 B u t t o n   1 5   L a b e l   D e c e l e r a t e A n d S t o p 
 
 B u t t o n   D e c e l e r a t e A n d S t o p   C o l o r   O r a n g e 
 
 
 
 B u t t o n   1 7   L a b e l   B _ R e s e t N e w t o n 
 
 B u t t o n   B _ R e s e t N e w t o n   T e x t   " R e s e t   N / m " 
 
 B u t t o n   B _ R e s e t N e w t o n   C o l o r   L i g h t G r e e n 
 
 B u t t o n   1 8   L a b e l   B _ T o r q u e N m 
 
 B u t t o n   1 9   L a b e l   B _ V e l o c i t y 
 
 B u t t o n   2 0   L a b e l   B _ V o l t a g e 
 
 B u t t o n   2 1   L a b e l   B _ C u r r e n t 
 
 B u t t o n   2 2   L a b e l   B _ P o w e r E l e c 
 
 B u t t o n   2 3   L a b e l   B _ P o w e r M e c 
 
 B u t t o n   2 4   L a b e l   B _ E f f i c i e n c y 
 
 B u t t o n   2 5   L a b e l   B _ F a c t o r N m W 
 
 B u t t o n   2 6   L a b e l   B _ T e m p e r a t u r e 
 
 
 
 K e y   U p       R e a d K e y s 
 
 K e y   D o w n   R e a d K e y s 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   A P P S 
 
 L o a d   " T h e r e m i n o _ H a l . e x e " 
 
 L o a d   C l o s e A p p s   " T h e r e m i n o _ C o b o t . e x e " 
 
 L o a d   " T h e r e m i n o _ M o t o r s . e x e " 
 
 L o a d   " T h e r e m i n o _ S l o t V i e w e r 1 . e x e " 
 
 L o a d   C l o s e A p p s   " T h e r e m i n o _ S l o t V i e w e r 2 . e x e " 
 
 L o a d   C l o s e A p p s   " T h e r e m i n o _ S l o t V i e w e r 3 . e x e " 
 
 L o a d   " T h e r e m i n o _ S i g n a l S c o p e 1 . e x e " 
 
 L o a d   " T h e r e m i n o _ S i g n a l S c o p e 2 . e x e " 
 
 L o a d   " T h e r e m i n o _ S i g n a l S c o p e 3 . e x e " 
 
 L o a d   " T h e r e m i n o _ L o g g e r 1 2 . e x e " 
 
 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S T A R T 
 
 O p t i o n   S p e e d   9 
 
 I n i t S l o t s ( M o t o r I D ) 
 
 W a i t G o o d C o m m u n i c a t i o n 
 
 
 
 D e s t i n a t i o n   =   P o s i t i o n 
 
 U p d a t e M o t o r V a l u e s 
 
 
 
 R e s e t N e w t o n 
 
 S h o w T o r q u e 
 
 S h o w A c c e l e r a t i o n 
 
 S h o w S p e e d 
 
 S h o w N m 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   L O O P 
 
 G o s u b   L o o p 
 
 S t o p 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S T O P 
 
 L a b e l   E v e n t S t o p 
 
 	 S t o p M o t o r 
 
 E n d 
 
 
 
 L a b e l   S t o p M o t o r 
 
 	 D e s t i n a t i o n   =   P o s i t i o n 
 
 	 U p d a t e M o t o r V a l u e s 
 
 	 S e t W o r k i n g M o d e ( 0 ) 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     I N I T I A L I Z A T I O N S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 L a b e l   I n i t S l o t s 
 
 	 V a r i a b l e   N u m e r i c   I S 1 
 
 	 I S 1   =   I S 1   *   1 0 0 
 
 	 V a r i a b l e   N u m e r i c   S _ A c t u a l P o s           =   I S 1   +   1 0 
 
 	 V a r i a b l e   N u m e r i c   S _ A c t u a l S p e e d       =   I S 1   +   1 8 
 
 	 ' V a r i a b l e   N u m e r i c   S _ A c t u a l C u r r e n t   =   I S 1   +   2 0 
 
 	 V a r i a b l e   N u m e r i c   S _ A c t u a l V o l t a g e   =   I S 1   +   2 2 
 
 	 V a r i a b l e   N u m e r i c   S _ A c t u a l T e m p         =   I S 1   +   2 4 
 
 	 V a r i a b l e   N u m e r i c   s _ W r i t e P r o t           =   I S 1   +   5 0 
 
 	 V a r i a b l e   N u m e r i c   s _ W o r k i n g M o d e       =   I S 1   +   5 1 
 
 	 V a r i a b l e   N u m e r i c   s _ G o a l P o s               =   I S 1   +   5 8 
 
 	 V a r i a b l e   N u m e r i c   s _ G o a l T o r q u e         =   I S 1   +   6 2 
 
 	 V a r i a b l e   N u m e r i c   s _ G o a l A c c               =   I S 1   +   6 4 
 
 	 V a r i a b l e   N u m e r i c   s _ G o a l S p e e d           =   I S 1   +   6 6 
 
 	 V a r i a b l e   N u m e r i c   s _ P i d P                     =   I S 1   +   6 8 
 
 	 V a r i a b l e   N u m e r i c   s _ P i d I                     =   I S 1   +   6 9 
 
 	 V a r i a b l e   N u m e r i c   s _ P i d D                     =   I S 1   +   7 0 
 
 	 V a r i a b l e   N u m e r i c   s _ D e a d B a n d             =   I S 1   +   7 1 
 
 	 V a r i a b l e   N u m e r i c   s _ Z e r o C u r r e n t       =   I S 1   +   7 2 
 
 	 
 
 	 V a r i a b l e   N u m e r i c   s _ C u r r e n t A D C     =   2 
 
 	 V a r i a b l e   N u m e r i c   s _ T o r q u e A D C       =   1 3 
 
 	 
 
 	 V a r i a b l e   N u m e r i c   s _ C u r r e n t           =   2 0 
 
 	 V a r i a b l e   N u m e r i c   s _ N e w t o n             =   2 1 
 
 	 V a r i a b l e   N u m e r i c   s _ E l e c W               =   2 2 
 
 	 V a r i a b l e   N u m e r i c   s _ M e c W                 =   2 3 
 
 	 V a r i a b l e   N u m e r i c   s _ E f f i c i e n c y     =   2 4 
 
 	 V a r i a b l e   N u m e r i c   s _ F a c t o r N m W       =   2 5 
 
 R e t u r n 
 
 
 
 L a b e l   I n i t A l l P a r a m s 
 
 	 S l o t   s _ G o a l T o r q u e   =   0 
 
 	 S l o t   s _ G o a l A c c   =   0 
 
 	 S l o t   s _ G o a l S p e e d   =   0 
 
 	 S l o t   s _ P i d P   =   0 
 
 	 S l o t   s _ P i d I   =   0 
 
 	 S l o t   s _ P i d D   =   0 
 
 	 S l o t   s _ D e a d B a n d   =   0 
 
 	 S l o t   s _ Z e r o C u r r e n t   =   0 
 
 	 P o s i t i o n   =   S l o t ( S _ A c t u a l P o s ) 
 
 	 D e s t i n a t i o n   =   P o s i t i o n 
 
 	 S l o t ( s _ G o a l P o s )   =   D e s t i n a t i o n 
 
 	 S l o t   s _ G o a l T o r q u e   =   M a x T O R Q U E 
 
 	 S l o t   s _ G o a l A c c   =   M a x A C C 
 
 	 S l o t   s _ G o a l S p e e d   =   M a x R P M 
 
 	 S l o t   s _ P i d P   =   P i d K P 
 
 	 S l o t   s _ P i d I   =   P i d K I 
 
 	 S l o t   s _ P i d D   =   P i d K D 
 
 	 S l o t   s _ D e a d B a n d   =   D e a d B a n d 
 
 	 S l o t   s _ Z e r o C u r r e n t   =   Z e r o S p e e d C u r r e n t 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 	 S e t W o r k i n g M o d e ( 1 )   '   1   =   P o s i t i o n 
 
 R e t u r n 
 
 
 
 '   - - - - - - - - - - - - -   S E T   W O R K I N G   M O D E   1 = P o s i t i o n   2 = S p e e d 
 
 L a b e l   S e t W o r k i n g M o d e 
 
 	 V a r i a b l e   N u m e r i c   S W M 1 
 
 	 S l o t ( s _ W r i t e P r o t )   =   1       '   W r i t e - P r o t e c t i o n   O N 
 
 	 W a i t   S e c o n d s   0 . 0 5 
 
 	 S l o t ( s _ W r i t e P r o t )   =   0       '   W r i t e - P r o t e c t i o n   O F F 
 
 	 W a i t   S e c o n d s   0 . 0 5 
 
 	 S l o t ( s _ W o r k i n g M o d e )   =   0   '   W o r k i n g   m o d e   =   0 
 
 	 W a i t   S e c o n d s   0 . 0 5 
 
 	 S l o t ( s _ W o r k i n g M o d e )   =   S W M 1   '   W o r k i n g   m o d e 
 
 	 W a i t   S e c o n d s   0 . 0 5 
 
 	 S l o t ( s _ W r i t e P r o t )   =   1       '   W r i t e - P r o t e c t i o n   O N 
 
 	 W a i t   S e c o n d s   0 . 0 5 
 
 R e t u r n 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T O R Q U E 
 
 L a b e l   B _ T o r q u e 
 
 	 S e l e c t   S l o t ( s _ G o a l T o r q u e ) 
 
 	 	 C a s e   1 0 
 
 	 	 	 S l o t ( s _ G o a l T o r q u e )   =   2 0 
 
 	 	 C a s e   2 0 
 
 	 	 	 S l o t ( s _ G o a l T o r q u e )   =   5 0 
 
 	 	 C a s e   5 0 
 
 	 	 	 S l o t ( s _ G o a l T o r q u e )   =   1 0 0 
 
 	 	 C a s e   1 0 0 
 
 	 	 	 S l o t ( s _ G o a l T o r q u e )   =   2 0 0 
 
 	 	 C a s e   2 0 0 
 
 	 	 	 S l o t ( s _ G o a l T o r q u e )   =   5 0 0 
 
 	 	 C a s e   5 0 0 
 
 	 	 	 S l o t ( s _ G o a l T o r q u e )   =   1 0 0 0 
 
 	 	 C a s e   1 0 0 0 
 
 	 	 	 S l o t ( s _ G o a l T o r q u e )   =   2 0 0 0 
 
 	 	 C a s e E l s e 
 
 	 	 	 S l o t ( s _ G o a l T o r q u e )   =   2 0 
 
 	 E n d S e l e c t 
 
 	 S h o w T o r q u e 
 
 R e t u r n 
 
 
 
 L a b e l   S h o w T o r q u e 
 
 	 B u t t o n   B _ T o r q u e   T e x t   " T o r q u e   =   "   +   S l o t ( s _ G o a l T o r q u e ) 
 
 R e t u r n 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   A C C E L E R A T I O N 
 
 L a b e l   B _ A c c e l e r a t i o n 
 
 	 S e l e c t   S l o t ( s _ G o a l A c c ) 
 
 	 	 C a s e   2 0 
 
 	 	 	 S l o t ( s _ G o a l A c c )   =   1 0 0 
 
 	 	 C a s e   1 0 0 
 
 	 	 	 S l o t ( s _ G o a l A c c )   =   1 0 0 0 
 
 	 	 C a s e   1 0 0 0 
 
 	 	 	 S l o t ( s _ G o a l A c c )   =   1 0 0 0 0 
 
 	 	 C a s e E l s e 
 
 	 	 	 S l o t ( s _ G o a l A c c )   =   2 0 
 
 	 E n d S e l e c t 
 
 	 S h o w A c c e l e r a t i o n 
 
 R e t u r n 
 
 
 
 L a b e l   S h o w A c c e l e r a t i o n 
 
 	 B u t t o n   B _ A c c e l e r a t i o n   T e x t   " A c c e l .   =   "   +   S l o t ( s _ G o a l A c c ) 
 
 R e t u r n 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S P E E D 
 
 L a b e l   B _ S p e e d 
 
 	 S e l e c t   S l o t ( s _ G o a l S p e e d ) 
 
 	 	 C a s e   5 0 0 
 
 	 	 	 S l o t ( s _ G o a l S p e e d )   =   1 0 0 0 
 
 	 	 C a s e   1 0 0 0 
 
 	 	 	 S l o t ( s _ G o a l S p e e d )   =   1 5 0 0 
 
 	 	 C a s e   1 5 0 0 
 
 	 	 	 S l o t ( s _ G o a l S p e e d )   =   2 0 0 0 
 
 	 	 C a s e E l s e 
 
 	 	 	 S l o t ( s _ G o a l S p e e d )   =   5 0 0 
 
 	 E n d S e l e c t 
 
 	 S h o w S p e e d 
 
 R e t u r n 
 
 
 
 L a b e l   S h o w S p e e d 
 
 	 B u t t o n   B _ S p e e d   T e x t   " R P M   =   "   +   S l o t ( s _ G o a l S p e e d ) 
 
 R e t u r n 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   N e w t o n   M e t e r 
 
 L a b e l   B _ N e w t o n M e t e r 
 
 	 S e l e c t   T e s t N m 
 
 	 	 C a s e   2 
 
 	 	 	 T e s t N m   =   4 
 
 	 	 C a s e   4 
 
 	 	 	 T e s t N m   =   6 
 
 	 	 C a s e   6 
 
 	 	 	 T e s t N m   =   8 
 
 	 	 C a s e E l s e 
 
 	 	 	 T e s t N m   =   2 
 
 	 E n d S e l e c t 
 
 	 S h o w N m 
 
 R e t u r n 
 
 
 
 L a b e l   S h o w N m 
 
 	 B u t t o n   B _ N e w t o n M e t e r   T e x t   " N m .   =   "   +   T e s t N m 
 
 R e t u r n 
 
 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   M O T O R   C O N T R O L 
 
 V a r i a b l e   N u m e r i c   M o t o r I D 
 
 V a r i a b l e   N u m e r i c   M a x T O R Q U E 
 
 V a r i a b l e   N u m e r i c   M a x A C C 
 
 V a r i a b l e   N u m e r i c   M a x R P M 
 
 V a r i a b l e   N u m e r i c   P o s i t i o n 
 
 V a r i a b l e   N u m e r i c   D e s t i n a t i o n 
 
 V a r i a b l e   N u m e r i c   P i d K P 
 
 V a r i a b l e   N u m e r i c   P i d K I 
 
 V a r i a b l e   N u m e r i c   P i d K D 
 
 V a r i a b l e   N u m e r i c   D e a d B a n d 
 
 V a r i a b l e   N u m e r i c   Z e r o S p e e d C u r r e n t 
 
 V a r i a b l e   N u m e r i c   K r e d u c t i o n 
 
 
 
 L a b e l   M o v e B y 
 
 	 V a r i a b l e   N u m e r i c   M B 1 
 
 	 D e s t i n a t i o n   =   D e s t i n a t i o n   +   M B 1 
 
 	 U p d a t e M o t o r V a l u e s 
 
 R e t u r n 
 
 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   M O V E   B U T T O N S 
 
 L a b e l   + 1 0 _ t u r n s 
 
 	 D e s t i n a t i o n   =   D e s t i n a t i o n   +   3 6 0 0 
 
 R e t u r n 
 
 L a b e l   - 1 0 _ t u r n s 
 
 	 D e s t i n a t i o n   =   D e s t i n a t i o n   -   3 6 0 0 
 
 R e t u r n 
 
 L a b e l   + 1 0 0 _ t u r n s 
 
 	 D e s t i n a t i o n   =   D e s t i n a t i o n   +   3 6 0 0 0 
 
 R e t u r n 
 
 L a b e l   - 1 0 0 _ t u r n s 
 
 	 D e s t i n a t i o n   =   D e s t i n a t i o n   -   3 6 0 0 0 
 
 R e t u r n 
 
 
 
 L a b e l   G o t o - Z e r o 
 
 	 D e s t i n a t i o n   =   0 
 
 R e t u r n 
 
 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   K E Y S 
 
 L a b e l   R e a d K e y s 
 
 	 V a r i a b l e   N u m e r i c   J o g S p e e d 
 
 	 J o g S p e e d   =   1 
 
 	 S e l e c t   T r u e 
 
 	 	 C a s e   K e y ( " S H I F T " ) 
 
 	 	 	 J o g S p e e d   =   J o g S p e e d   *   1 0 
 
 	 	 C a s e   K e y ( " C T R L " ) 
 
 	 	 	 J o g S p e e d   =   J o g S p e e d   *   0 . 1 
 
 	 	 C a s e   K e y ( " A L T " ) 
 
 	 	 	 J o g S p e e d   =   J o g S p e e d   *   0 . 0 1 
 
 	 E n d S e l e c t 
 
 	 I f   K e y ( " U P " ) 
 
 	 	 D e s t i n a t i o n   =   D e s t i n a t i o n   +   J o g S p e e d 
 
 	 E n d I f 
 
 	 I f   K e y ( " D O W N " ) 
 
 	 	 D e s t i n a t i o n   =   D e s t i n a t i o n   -   J o g S p e e d 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     L O O P 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   L o o p 
 
 	 U p d a t e M o t o r V a l u e s 
 
 	 P r i n t V a l u e s 
 
 	 M e a s u r e C u r r e n t A n d T o r q u e 
 
 	 W a i t   S e c o n d s   0 . 0 1 
 
 	 T e s t C o m m u n i c a t i o n 
 
 	 E n a b l e D i s a b l e B u t t o n s 
 
 	 D e c e l e r a t e A n d S t o p T e s t 
 
 G o t o   L o o p 
 
 
 
 L a b e l   U p d a t e M o t o r V a l u e s 
 
 	 S l o t ( s _ G o a l P o s )   =   D e s t i n a t i o n 
 
 	 P o s i t i o n   =   S l o t ( S _ A c t u a l P o s ) 
 
 R e t u r n 
 
 
 
 L a b e l   P r i n t V a l u e s 
 
 	 s 1   =   " D e s t i n a t i o n :   "   +   F o r m a t ( D e s t i n a t i o n ,   " 0 . 0 0 " ) 
 
 	 s 1   =   s 1   +   "       P o s i t i o n :   "   +   F o r m a t ( P o s i t i o n ,   " 0 . 0 0 " ) 
 
 	 P r i n t   s 1 
 
 R e t u r n 
 
 
 
 L a b e l   T e s t C o m m u n i c a t i o n 
 
 	 I f   S l o t ( 5 6 )   <   1 0 
 
 	 	 W a i t G o o d C o m m u n i c a t i o n 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 L a b e l   W a i t G o o d C o m m u n i c a t i o n 
 
 	 F o r   v 1   =   1   T o   I n f i n i t y 
 
 	 	 I f   S l o t ( 5 6 )   >   5 0 
 
 	 	 	 v 2   =   v 2   +   1 
 
 	 	 E l s e 
 
 	 	 	 v 2   =   0 
 
 	 	 E n d I f 
 
 	 	 I f   v 2   >   5 0 
 
 	 	 	 B e e p   " 4 4 0 - 8 0 , 0 - 3 2 0 , 3 3 0 - 8 0 , 4 4 0 - 8 0 , 6 6 0 - 8 0 " 
 
 	 	 	 I n i t A l l P a r a m s 
 
 	 	 	 E x i t 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 0 1 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 L a b e l   E n a b l e D i s a b l e B u t t o n s 
 
 	 I f   A b s ( D e s t i n a t i o n   -   P o s i t i o n )   >   1 
 
 	 	 B u t t o n   B _ T o r q u e   D i s a b l e d 
 
 	 	 B u t t o n   B _ A c c e l e r a t i o n   D i s a b l e d 
 
 	 	 B u t t o n   B _ S p e e d   D i s a b l e d 
 
 	 E l s e 
 
 	 	 B u t t o n   B _ T o r q u e   E n a b l e d 
 
 	 	 B u t t o n   B _ A c c e l e r a t i o n   E n a b l e d 
 
 	 	 B u t t o n   B _ S p e e d   E n a b l e d 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     M E A S U R E   M O T O R   P A R A M E T E R S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 '     T A R A T U R A   C E L L A   D I   C A R I C O   I N   N E W T O N / M E T R O 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 '     -   F a r e   p r i m a   l a   t a r a 
 
 '     -   A g g i u n g e r e   1 0 2 0   g r a m m i   a   2 0   c e n t i m e t r i 
 
 '     -   R e g o l a r e   i l   K _ N e w t o n   p e r   o t t e n e r e   2 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 
 
 V a r i a b l e   N u m e r i c   K _ C u r r e n t   =   0 . 0 0 4 5   '   0 . 0 0 3 7 5   t e o r i c   w i t h   0 . 0 4   o h m 
 
 V a r i a b l e   N u m e r i c   K _ N e w t o n   =   1 . 0 1 
 
 
 
 V a r i a b l e   N u m e r i c   T o r q u e C e l l Z e r o 
 
 V a r i a b l e   N u m e r i c   N e w t o n M e t e r s 
 
 V a r i a b l e   N u m e r i c   V e l o c i t y 
 
 V a r i a b l e   N u m e r i c   V o l t a g e 
 
 V a r i a b l e   N u m e r i c   C u r r e n t 
 
 V a r i a b l e   N u m e r i c   T e m p e r a t u r e 
 
 V a r i a b l e   N u m e r i c   E l e c t r i c a l W a t t 
 
 V a r i a b l e   N u m e r i c   M e c h a n i c a l W a t t 
 
 V a r i a b l e   N u m e r i c   F a c t o r N m W 
 
 V a r i a b l e   N u m e r i c   E f f i c i e n c y 
 
 
 
 L a b e l   R e s e t N e w t o n 
 
 	 T o r q u e C e l l Z e r o   =   S l o t ( s _ T o r q u e A D C ) 
 
 R e t u r n 
 
 
 
 L a b e l   M e a s u r e C u r r e n t A n d T o r q u e 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T O R Q U E 
 
 	 N e w t o n M e t e r s   =   K _ N e w t o n   *   ( S l o t ( s _ T o r q u e A D C )   -   T o r q u e C e l l Z e r o ) 
 
 	 S l o t ( s _ N e w t o n )   =   N e w t o n M e t e r s 
 
 	 B u t t o n   B _ T o r q u e N m   T e x t   " T o r q u e   "   +   F o r m a t ( N e w t o n M e t e r s ,   " 0 . 0 " )   +   "   N / m " 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   S P E E D 
 
 	 V e l o c i t y   =   S l o t ( S _ A c t u a l S p e e d   ) 
 
 	 B u t t o n   B _ V e l o c i t y   T e x t   " S p e e d   "   +   V e l o c i t y   +   "   R P M " 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   V O L T A G E 
 
 	 V o l t a g e   =   S l o t ( S _ A c t u a l V o l t a g e ) 
 
 	 B u t t o n   B _ V o l t a g e   T e x t   " V o l t a g e   "   +   F o r m a t ( V o l t a g e ,   " 0 . 0 " )   +   "   V " 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   C U R R E N T 
 
 	 C u r r e n t   =   K _ C u r r e n t   *   S l o t ( s _ C u r r e n t A D C ) 
 
 	 S l o t ( s _ C u r r e n t )   =   C u r r e n t 
 
 	 B u t t o n   B _ C u r r e n t   T e x t   " C u r r e n t   "   +   F o r m a t ( C u r r e n t ,   " 0 . 0 0 " )   +   "   A " 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   E L E C .   P O W E R 
 
 	 E l e c t r i c a l W a t t   =   S l o t ( S _ A c t u a l V o l t a g e )   *   C u r r e n t 
 
 	 S l o t ( s _ E l e c W )   =   E l e c t r i c a l W a t t 
 
 	 B u t t o n   B _ P o w e r E l e c   T e x t   " P o w   E l e c .   "   +   F o r m a t ( E l e c t r i c a l W a t t ,   " 0 " )   +   "   W " 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   M E C .   P O W E R 
 
 	 M e c h a n i c a l W a t t   =   N e w t o n M e t e r s   /   4 1   *   2   *   M a t h _ P I   *   S l o t ( S _ A c t u a l S p e e d )   /   6 0 
 
 	 M e c h a n i c a l W a t t   =   M a x ( M e c h a n i c a l W a t t ,   0 ) 
 
 	 S l o t ( s _ M e c W )   =   M e c h a n i c a l W a t t 
 
 	 B u t t o n   B _ P o w e r M e c   T e x t   " P o w   M e c c .   "   +   F o r m a t ( M e c h a n i c a l W a t t ,   " 0 " )   +   "   W " 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   E F F I C I E N C Y 
 
 	 E f f i c i e n c y   =   1 0 0   *   M e c h a n i c a l W a t t   /   E l e c t r i c a l W a t t 
 
 	 S l o t ( s _ E f f i c i e n c y )   =   E f f i c i e n c y 
 
 	 B u t t o n   B _ E f f i c i e n c y   T e x t   " E f f i c i e n c y   "   +   F o r m a t ( E f f i c i e n c y ,   " 0 " )   +   "   % " 
 
         '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   F a c t o r   N m W 
 
 	 F a c t o r N m W   =   M a x ( A b s ( N e w t o n M e t e r s )   /   E l e c t r i c a l W a t t ,   0 ) 
 
 	 S l o t ( s _ F a c t o r N m W )   =   F a c t o r N m W 
 
 	 B u t t o n   B _ F a c t o r N m W   T e x t   F o r m a t ( F a c t o r N m W ,   " 0 . 0 0 0 " )   +   "   N m / W " 
 
 	 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T E M P E R A T U R E 
 
 	 T e m p e r a t u r e   =   S l o t ( S _ A c t u a l T e m p ) 
 
 	 B u t t o n   B _ T e m p e r a t u r e   T e x t   " T e m p .   "   +   T e m p e r a t u r e   +   "    C " 
 
 R e t u r n 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     D E C E L E R A T E   A N D   S T O P 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   D e c e l e r a t e A n d S t o p 
 
 	 D e s t i n a t i o n   =   P o s i t i o n 
 
 	 D e c e l e r a t e A n d S t o p F l a g   =   1 
 
 R e t u r n 
 
 
 
 V a r i a b l e   N u m e r i c   D e c e l e r a t e A n d S t o p F l a g 
 
 
 
 L a b e l   D e c e l e r a t e A n d S t o p T e s t 
 
 	 I f   D e c e l e r a t e A n d S t o p F l a g   =   1 
 
 	 	 I f   A b s ( S l o t ( S _ A c t u a l S p e e d ) )   <   1 0 
 
 	 	 	 D e c e l e r a t e A n d S t o p F l a g   =   0 
 
 	 	 	 D e s t i n a t i o n   =   P o s i t i o n 
 
 	 	 E n d I f 
 
 	 E n d I f 
 
 R e t u r n 
 
 
 
 
 
 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '     T E S T   F U N C T I O N S 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 '   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   T E S T   C O N T R O L 
 
 V a r i a b l e   N u m e r i c   T e s t N m 
 
 V a r i a b l e   N u m e r i c   M a x T e m p 
 
 V a r i a b l e   N u m e r i c   M i n T e m p 
 
 
 
 L a b e l   L o n g T e s t 
 
 	 F o r   v 1   =   0   T o   1 0 0 
 
 	 N e x t 
 
 R e t u r n 
 
 
 
 
 
 ' B O O K M A R K S   3 6 4   3 5 8   3 5 4   
 
 
 
 ' E D I T E D L I N E S   
 
 
 
 ' E X E C   K _ N e w t o n   =   1 . 0 1 
 
 